#pragma once

#include <math.h>

void morelos_decode (double *mesg, double *parity1, double *parity2, unsigned size,  double sigma, int iteration);

void deinterleavedouble(double *mesg, unsigned size);
void interleavedouble(double *mesg, unsigned size);
void encode(bool *mesg,bool *parity,unsigned size, bool force);
void interleave(bool *mesg,unsigned size);
void deinterleave(bool *mesg,unsigned size);

extern int numstates;
extern unsigned *tostate[2];
extern unsigned *fromstate[2];
extern bool *output[2];
extern double **a[2];
extern double **b[2];
extern double *L[2];
extern double **gamma[2][2];
extern double **gammaE[2][2];
extern bool initialized;
extern unsigned *interleavearray;
extern unsigned *deinterleavearray;